package pers.ascend.spring.cloud.dalston.service.governance.eureka.consumer.feign.manage.feign;

import org.hibernate.validator.constraints.NotBlank;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import pers.ascend.spring.cloud.dalston.service.governance.eureka.consumer.feign.base.config.feign.MultipartSupportConfig;

import javax.validation.constraints.NotNull;

/**
 * 说明：
 *
 * @author ascend
 * 2021/3/9 16:45
 */
@FeignClient(name = "eureka-producer", path = "/producer", configuration = MultipartSupportConfig.class)
public interface EurekaProducerFeign {

    @GetMapping(value = "/hello")
    String hello(@RequestParam("name") @NotBlank String name);

    @PostMapping(path = "/upload-file1", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    String uploadFile1(@RequestPart("file") @NotNull MultipartFile file);

    @PostMapping(path = "/upload-file2", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    String uploadFile2(@RequestParam("nickname") String nickname, @RequestPart("file") @NotNull MultipartFile file);
}
